package teamGiga.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import teamGiga.bean.QnaBean;
import teamGiga.dao.MovieDao;
import action.servlet.ActionForWard;

public class QnaModifyAction extends Action{
	private String path;
	private boolean redirect;
	public QnaModifyAction() {
		super();
	}
	public QnaModifyAction(String path, boolean redirect) {
		super();
		this.path = path;
		this.redirect = redirect;
	}
	@Override
	public ActionForWard execute(HttpServletRequest request,
			HttpServletResponse response) {
		// TODO Auto-generated method stub
		int no = Integer.parseInt(request.getParameter("no"));
		QnaBean bean = new QnaBean(no, (int)request.getSession().getAttribute("mbno"), 
									request.getParameter("qnatitle"),
									request.getParameter("qnacontents"));		
		try {
			System.out.println("modifybean= "+bean);
			MovieDao.modifyQna(bean);
		} catch (Exception e) {
			// TODO: handle exception
		}
		path=path+"&no="+no;
		return new ActionForWard(path, redirect);
	}
	
	
}
